@model EditOpenIdScopeViewModel
@using OrchardCore.OpenId.ViewModels;

<h1>@RenderTitleSegments(T["Edit a scope"])</h1>

<div asp-validation-summary="ModelOnly"></div>
<form asp-action="Edit" method="post">
    <div class="form-group" asp-validation-class-for="Name">
        <label asp-for="Name">@T["Name"]</label>
        <span asp-validation-for="Name" class="text-danger"></span>
        <input asp-for="Name" class="form-control" autofocus />
    </div>

    <div class="form-group" asp-validation-class-for="DisplayName">
        <label asp-for="DisplayName">@T["Display Name"]</label>
        <span asp-validation-for="DisplayName" class="text-danger"></span>
        <input asp-for="DisplayName" class="form-control" />
    </div>

    <div class="form-group" asp-validation-class-for="Description">
        <label asp-for="Description">@T["Description"]</label>
        <span asp-validation-for="Description" class="text-danger"></span>
        <textarea asp-for="Description" class="form-control"></textarea>
    </div>

    <div class="form-group" id="TenantGroup" name="TenantGroup">
        <h6>@T["Tenants"]</h6>
        @for (var index = 0; index < Model.Tenants.Count; index++)
        {
            <div class="form-check">
                <label class="form-check-label" asp-for="Tenants[index].Selected">
                    <input class="form-check-input" type="checkbox" asp-for="Tenants[index].Selected"
                           disabled="@Model.Tenants[index].Current" />
                    <input type="hidden" asp-for="Tenants[index].Name" />
                    @Model.Tenants[index].Name
                </label>
            </div>
        }
    </div>

    <div class="form-group" asp-validation-class-for="Resources">
        <label asp-for="Resources">@T["Additional resources (API audiences)"]</label>
        <span asp-validation-for="Resources" class="text-danger"></span>
        <input asp-for="Resources" class="form-control" />
    </div>

    <fieldset>
        <div class="form-group">
            <button class="btn btn-primary" type="submit">@T["Save"]</button>
            <a class="btn btn-secondary" asp-route-action="Index">@T["Cancel"]</a>
        </div>
    </fieldset>
</form>